package com.strategy.example;


import com.strategy.annotation.Strategy;
import com.strategy.core.AbstractStrategy;

import java.util.Map;

/**
 * 乘法策略示例
 */
@Strategy(
        key = "calculator_multiply",
        version = "1.0.0",
        description = "乘法计算策略：将输入值与参数multiplier相乘"
)
public class MultiplyStrategy extends AbstractStrategy<Integer, Integer, Integer> {

    @Override
    public Integer execute(Integer input, Map<String, Integer> params) {
        if (params == null || !params.containsKey("multiplier")) {
            throw new IllegalArgumentException("参数中必须包含multiplier");
        }
        return input * params.get("multiplier");
    }
}
